<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <table border="1">
        <tr>
            <th>序号</th>
            <th>英雄</th>
            <th>皮肤</th>
        </tr>
    </table>
    <script src="./js/jquery-1.12.4.js"></script>
    <script>
        $.get("http://127.0.0.1:3001/getHeroSkin", function (result) {
            let list = result.data.list
            let html = ''
            list.forEach((item, index) => {
                html += `<tr>
                    <td>${index}</td>
                    <td>${item.cname}</td>
                    <td>${item.skin_name}</td>
                        </tr>`
            })
            $('table').append(html)
            $("tr td:nth-child(2)").on('click', function () {
                console.log('当前英雄的姓名是：' + $(this).text());
            })
            $("tr td:nth-child(3)").on('click', function () {
                console.log('当前英雄的姓名是：' + $(this).prev().text() + ';' + '当前英雄的皮肤是：' + $(this).text());
            })
        })


    </script>
</body>

</html>